import { service } from "../http/request";

/**
 *  提交请假申请
 */
const addApply = (params) => {
  return service ({
    method: 'post',
    url: '/leaveApply/addApply',
    data: params
  })

}

/**
 * 主管获取待审批数据
 */
const getApplyByDirector = (depId) => {
  return service({
    method:'get',
    url:`/leaveApply/getApplyByDirector/${depId}`
  })
}

const getApplyByManager = (depId) => {
  return service({
    method:'get',
    url:`/leaveApply/getApplyByManager/${depId}`
  })
}

const getMyRecord = () => {
  return service({
    method: 'get',
    url: '/leaveApply/getMyRecord'
  })
}

/**
 * 通过审核
 */
const acceptApplyStatus = (param) => {
  return service ({
    method: 'put',
    url: '/leaveApply/acceptApplyStatus',
    data: param
  })
}

/**
 * 拒绝
 */
const refuseApplyStatus = (param) => {
  return service ({
    method: 'put',
    url: '/leaveApply/refuseApplyStatus',
    data: param
  })
}

export default {
  addApply,
  getApplyByDirector,
  getApplyByManager,
  getMyRecord,
  acceptApplyStatus,
  refuseApplyStatus
}
